package com.gjw.result;

import lombok.AllArgsConstructor;
import lombok.Data;

import java.util.HashMap;
import java.util.Map;


public class ResultBean {
    private Integer code;
    private String msg;
    private Object data;

    public ResultBean(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public ResultBean(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public ResultBean(Object data) {
        this.data = data;
    }

//    public static Map result(Integer code, String msg, Object data){
//        HashMap map = new HashMap();
//        map.put("code",code);
//        map.put("msg",msg);
//        map.put("data",data);
//        return map;
//    }
//
//    public static Map result(Integer code,String msg){
//        HashMap map = new HashMap();
//        map.put("code",code);
//        map.put("msg",msg);
//        return map;
//    }

    public static ResultBean success(Object data){
        return new ResultBean(200,"成功",data);
    }

    public static ResultBean fail(Integer code,String msg){
        return new ResultBean(code,msg);
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
